package userTag

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method "POST"
        url value(consumer(regex("api/programs/tags")),
                producer("api/programs/tags"))
        body("""
            {   
                "name": "333",
                "color": "#333"
            }
        """)
        bodyMatchers {
            jsonPath('$.name', byRegex(nonEmpty()))
            jsonPath('$.color', byRegex(nonEmpty()))
        }
        headers {
            contentType(applicationJsonUtf8())
        }
    }
    response {
        status 201
        body("""
            {   
                "name": "333",
                "color": "#333"
            }
        """)
        bodyMatchers {
            jsonPath('$.name', byRegex(nonEmpty()))
            jsonPath('$.color', byRegex(nonEmpty()))
        }
        headers {
            contentType(applicationJsonUtf8())
        }
    }

}
